import React from 'react';
import cn from 'classnames';
import styles from './index.less';

export default function DetailItem({ label, labelWidth, colon = true, className, contentStyle, children, ...rest }) {
    return (
        <div className={cn(className, styles.wrapper)} {...rest}>
            {label && (
                <span className={styles.label} style={{ width: labelWidth || 'auto' }}>
                    {label}
                    {colon && '：'}
                </span>
            )}
            <span className={styles.value} style={contentStyle}>
                {children}
            </span>
        </div>
    );
}
